import { RouteRecordRaw } from 'vue-router';
import businessRoutes from './modules';

/************************************************************************************
 * 特殊约定：
 * 路由尽量加上Name属性，且和组件名称一致。
 * 需要keep-alive的路由和面包屑组件中的路由必须设置name！
 *
 * redirect == 'noRedirect' 在面包屑中禁止点击跳转
 * meta.breadcrumb === false 不显示在面包屑中
 * meta.affix === true 固定在标签栏
 * meta.noCache === true 不缓存页面
 *
 ***********************************************************************************/

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    component: () => import('src/layouts/MainLayout.vue'),
    children: [{ path: '', component: () => import('src/pages/IndexPage.vue'), meta: { title: '首页', icon: 'mdi-home' } }],
  },

  {
    path: '/login',
    name: 'Login',
    component: () => import('src/pages/LoginPage.vue'),
  },

  // 业务路由
  ...businessRoutes,

  {
    path: '/redirect',
    component: () => import('src/layouts/MainLayout.vue'),
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('src/pages/Redirect.vue'),
      },
    ],
  },

  // Always leave this as last one,
  // but you can also remove it
  {
    path: '/:catchAll(.*)*',
    component: () => import('src/pages/ErrorNotFound.vue'),
  },
];

export default routes;
